import { createApp, ref, readonly } from 'vue'
import App from './App.vue'
import axios from 'axios'
import router from './router'
import 'lib-flexible/flexible'
import {
  ActionBar,
  ActionBarIcon,
  ActionBarButton,
  Divider,
  Popup,
  Overlay,
  Loading,
  Dialog,
  ContactCard,
  Form,
  AddressEdit,
  AddressList,
  Field,
  CellGroup,
  Cell,
  SwipeCell,
  Icon,
  Stepper,
  Card,
  Checkbox,
  CheckboxGroup,
  Button,
  Swipe,
  SwipeItem,
  PullRefresh,
  List,
  Tab,
  Tabs,
  SubmitBar,
  Toast,
} from 'vant'
import 'vant/lib/index.css' // 全局引入样式

import ElementPlus from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
const app = createApp(App) // 创建实例
import { baseURL, contentType } from './config'
// 接口请求
const http = axios.create({
  baseURL: baseURL,
  headers: {
    'Content-Type': contentType,
    'X-Requested-With': 'XMLHttpRequest',
  },
})
const location = ref(baseURL)
app.provide('$location', readonly(location))
app.provide('$http', readonly(http))
app
  .use(ActionBarButton)
  .use(ActionBarIcon)
  .use(ActionBar)
  .use(Divider)
  .use(Popup)
  .use(Overlay)
  .use(Loading)
  .use(Dialog)
  .use(Toast)
  .use(ContactCard)
  .use(Form)
  .use(AddressEdit)
  .use(AddressList)
  .use(Field)
  .use(CellGroup)
  .use(Cell)
  .use(SwipeCell)
  .use(Icon)
  .use(Stepper)
  .use(Card)
  .use(Button)
  .use(Swipe)
  .use(SwipeItem)
  .use(PullRefresh)
  .use(List)
  .use(Tab)
  .use(Tabs)
  .use(SubmitBar)
  .use(Checkbox)
  .use(CheckboxGroup)
  .use(router)
  .use(ElementPlus)
  .mount('#app')
